<?php
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller {
    public function _initialize(){
      if (isset($_SESSION['name'])) {
      	# code...
      }else{
      	$this->error("请先登录","/Admin/Login/index",2);
      }
    }
}